<!--
 * @Descripttion: 
 * @version: 1.0
 * @Author: Sam
 * date: 2021-09-07 20:25:16
 * @LastEditors: Sam
 * @LastEditTime: 2021-09-27 11:58:27
-->
{include file="common/public/header"}
<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-card">
            <div class="layui-card-header">{$page_title}</div>
            <div class="layui-card-body">
                <form class="layui-form padsome" action="">  
                    <div class="layui-form-item" >
                        <div class="layui-form-label">类型</div>
                        <div class="layui-input-block">
                            <select  name="t_id"  lay-search >
                                {foreach $type as $item}
                                <option value="{$item.value}">{$item.title}</option>
                                {/foreach}
                            </select>
                        </div>
                    </div>
                    <div class="layui-form-item" >
                        <div class="layui-form-label">标题</div>
                        <div class="layui-input-block">
                            <input class="layui-input"  name="title"  lay-verify="required"  placeholder="请输入标题"  value=""/>
                        </div>
                    </div>
                    <div class="layui-form-item" >
                        <div class="layui-form-label">富文本</div>
                        <div class="layui-input-block">
                            <textarea name="content" id="content" style="width: 100%; height: 500px;"></textarea>
                        </div>
                    </div>
                    <div class="layui-form-item" >
                        <div class="layui-form-label">状态</div>
                        <div class="layui-input-block">
                            <input type="radio"  name="status"  title="显示" checked value="1" />
                            <input type="radio"  name="status"  title="隐藏"  value="0" />
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <div class="layui-input-block">
                            <div class="layui-footer" style="left: 0;">
                                <button class="layui-btn" lay-submit="">立即提交</button>
                                <button class="layui-btn layui-btn-primary" type="button" onclick="back_url()">返回</button>
                            </div>
                        </div>
                        <!--<div class="layui-input-block layui-layout-admin">-->
                            <!--<div class="layui-footer" style="left: 0;">-->
                                <!--<button class="layui-btn" lay-submit="">立即提交(iframe模式)</button>-->
                                <!--<button class="layui-btn layui-btn-primary" type="button" onclick="close_frame()">返回</button>-->
                            <!--</div>-->
                        <!--</div>-->
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
{include file="common/public/ueditor" /}
{include file="common/public/umeditor" /}
{include file="common/public/footer" /}
<script>
    layui.extend({
        xmSelect: 'xm-select'
    }).use(['index', 'form', 'layarea', 'laydate', 'xmSelect'], function(){
        var $       = layui.$;
        var form    = layui.form;
        // var xmSelect = layui.xmSelect;
        uploadInit('pic', 'image', '');
        uploadInit('pics', 'images', '');
        uploadInit('video', 'video', '');
        layui.laydate.render({elem:'#date', type:'date',trigger:'click'});
        layui.laydate.render({elem:'#datetime', type:'datetime',trigger:'click'});
        layui.laydate.render({elem:'#time', type:'time',trigger:'click'});
        layui.laydate.render({elem:'#datetime_range', type:'datetime',trigger:'click',range:true});
        layui.layarea.render({elem:'#area-picker'});
        UE.getEditor('content');
        xmSelect.render({el: '#selects', filterable: true,name:'selects', data: [{"value":1,"name":"选项1"},{"value":2,"name":"选项2"}], initValue: []});
        form.render();
        
        // 监听表单提交
        form.on('submit()', function(data){
            Post('', data.field, function(res) {
                if (res.code == 1) {
                    alert_success(res.msg, function() {
                        //parent.layui.table.reload('table', {where: parent.where});
                        back_url();
                    })
                } else {
                    alert_error(res.msg);
                }
            });
            return false;
        });

    <?php $extend_tpl = isset($tpl) ? file_get_contents($tpl) : ''; echo str_replace(['<script>', '</script>'], ['', ''], $extend_tpl)?>
});
</script>